﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace ECCSystem.DataAccess
{ 
    class ClsMailCategory:DBObject 
    {
        public DataSet GetMailCategory()
        {
            return RunProcedure("sp_MailCategory_GetList", new IDataParameter[] { }, "tMailCategory");
        }
		public void AddCategory(string strMailCategory, string strComment, string fotPoint, int intFlg)
        {
            SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@Name", SqlDbType.NVarChar, 100),
															 new SqlParameter("@Comment", SqlDbType.NVarChar, 100),
															 new SqlParameter("@Point", SqlDbType.VarChar,8),
															 new SqlParameter("@Flg", SqlDbType.Bit)};
			
			parameters[0].Value = strMailCategory;
			parameters[1].Value = strComment;
			parameters[2].Value = fotPoint.ToString();
			parameters[3].Value = intFlg;
            this.RunProcedure("sp_MailCategory_Add", parameters, "MailCategory");
        }
        public void DeleteCategory(string lngID)
        {
            SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ID", SqlDbType.UniqueIdentifier) };
			Guid guid = new Guid(lngID);
			parameters[0].Value = guid;
            this.RunProcedure("sp_MailCategory_Delete", parameters, "MailCategory");
        }

		public void UpdateCategory(string strID, string fotPoint, string strName, string strComment, int intFlg)
		{
			SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@Name", SqlDbType.NVarChar, 100),
															 new SqlParameter("@Comment", SqlDbType.NVarChar, 100),
															 new SqlParameter("@Point", SqlDbType.VarChar,8),
															 new SqlParameter("@ID", SqlDbType.UniqueIdentifier),
															 new SqlParameter("@Flg", SqlDbType.Bit)};

			parameters[0].Value = strName;
			parameters[1].Value = strComment;
			parameters[2].Value = fotPoint.ToString();
			Guid guid1 = new Guid(strID);
			parameters[3].Value = guid1;
			parameters[4].Value = intFlg;
			this.RunProcedure("sp_MailCategory_Update", parameters, "MailCategory");
		}
    }
}
